<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/10/8
  Time: 16:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/js/jquery-3.3.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/jquery.md5.js"></script>
    <link href="${pageContext.request.contextPath}/css/customer/login.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet">
</head>
<body>
<span id="message_id" style="font-size: 10px;color: red" >
</span>
<div class="login-img">
        <div class="w1180">
            <div class="login">
                <div class="login-left">
                    <img src="${pageContext.request.contextPath}/images/login-left.jpg">
                    <div class="login-left-text">
                        <div class="login-left-top">
                            <span></span>
                            "注册即享好礼"
                            <span></span>
                        </div>
                        <ul class="login-left-logo">
                            <li>
                                <span class="icon">减</span>
                                <p>登录就送优惠卷</p>
                            </li>
                            <li>
                                <span class="icon">￥</span>
                                <p>优惠满减满足你</p>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="login-right">
                    <form  class="form1"  method="post">
                    <div class="login-right-top">
                        <h3>会员登录</h3>
                    </div>
                    <!--                <div class="login-right-top1">-->
                    <!--                </div>-->
                    <div class="login-right-main">
                        <ul class="login-right-main1">
                            <li>
                                <input class="username" name="custTel" type="text" placeholder="请输入你的手机号" maxlength="11"/>
                                <span class="username-msg"></span>
                            </li>
                            <li>
                                <input class="password" name="custPassword" type="password" placeholder="请输入密码"/>
                                <span class="password-msg"></span>
                            </li>
                        </ul>
                        <div class="login-right-text">
                            <p><input type="checkbox"/>
                                未注册小橘租车账号的手机号，登录时将自动注册，且代表你已同意
                                <a href="">《小橘租车会员注册协议》</a>和
                                <a href="" >《小橘租车隐私政策》</a>
                            </p>
                        </div>
                        <div class="login-right-btn">
                            <input type="button" class="btn-popup" value="登录"/>
<%--                            <a href="" title="登录" class="btn-popup">登录</a>--%>
                        </div>

                        <div class="login-last">
                            还没账号？
                            <a href="${pageContext.request.contextPath}/customer/register">立即注册</a>
                        </div>
                    </div>
                    </form>
<%--                    ${loginMsg}--%>
                </div>
            </div>
        </div>
</div>
<script src="${pageContext.request.contextPath}/js/customer/login.js"></script>
<script>
$(".btn-popup").click(function () {
    var salt = "springbootdemo";
    var newPassword = $.md5($(".password").val()+salt);
    var custTel = $(".username").val();

    $.post( "${pageContext.request.contextPath}/customer/login",
        {
            custTel:custTel,
            custPassword:newPassword
        },
        function (result){
            if(result.code == 200){
                console.log("登录成功")
                window.location.href="${pageContext.request.contextPath}"
            }
            else
                $("#message_id").text("用户名或密码错误，请重新登录。");
        },
        "json");
})
</script>
</body>
</html>
